<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <meta name="format-detection"content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" /><!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" /><!-- 设置苹果工具栏颜色 -->
    <meta name="renderer" content="ie-comp">
    <meta name="renderer" content="ie-stand">
    <meta name="renderer" content="webkit"> 
    <meta name="keywords" content="耀盛中国,耀盛智投,理财产品,智选财富,耀盛智投官网"/>
    <meta name="description" content="耀盛智投为耀盛中国旗下理财产品智选平台。专注于为大众富裕阶层、精英个人、中产阶级家庭、合规机构等提供定制化资产配置咨询推荐服务，帮助客户实现财富的增值。" />
    <title>我的保险</title>
    <script src="../../lib/js/ftSize.js"></script>
    <link rel="stylesheet" href="../../lib/css/_base.css">
    <link rel="stylesheet" type="text/css" href="../../lib/css/myinsurance.css">
    <link rel="stylesheet" href="../../lib/css/minirefresh.min.css">
</head>
<body>
        <h1 class="rem90R"><img src="../../lib/images/left.png" class="leftImg" onClick="prevAttectation()">我的保险</h1>
        <div id="minirefresh" class="minirefresh-wrap" style="padding-top: .9rem;">
            <div class="minirefresh-scroll">
                <section id="myinsurance"></section>
            </div>
        </div>
<!-- <section id="myinsurance"> -->
   <!--  <div class="insurance_list">
        <div class="BX_title product-main" ><h2><img src="../../lib/images/left-tiao.png">尊享e生旗舰版</h2><span></span></div>
        <ul class="product-main bx_guarantee">
            <li><span>生效日期</span><em>2018-02-02</em></li>
            <li><span>终止日期</span><em>2019-02-02</em></li>
            <li><span>被保人</span><em>康熙</em></li>
            <li><span>保费</span><em>1000000.00元</em></li>
            <li><span>保额</span><em>100000000.00元</em></li>
        </ul>
    </div> -->
   <!--  <div class="insurance_list">
        <div class="BX_title product-main"><h2><img src="../../lib/images/left-tiao.png">尊享e生旗舰版</h2><span></span></div>
        <ul class="product-main bx_guarantee">
            <li><span>生效日期</span><em>2018-02-02</em></li>
            <li><span>终止日期</span><em>2019-02-02</em></li>
            <li><span>被保人</span><em>雍正</em></li>
            <li><span>保费</span><em>1000000.00元</em></li>
            <li><span>保额</span><em>100000000.00元</em></li>
        </ul>
    </div>
    <div class="insurance_list">
        <div class="BX_title product-main"><h2><img src="../../lib/images/left-tiao.png">尊享e生旗舰版</h2><span></span></div>
        <ul class="product-main bx_guarantee">
            <li><span>生效日期</span><em>2018-02-02</em></li>
            <li><span>终止日期</span><em>2019-02-02</em></li>
            <li><span>被保人</span><em>乾隆</em></li>
            <li><span>保费</span><em>1000000.00元</em></li>
            <li><span>保额</span><em>100000000.00元</em></li>
        </ul>
    </div> -->
<!-- </section> -->
<div class="common_myriad" id="myinsuranceNo" style="display:none;">
        <img src="../../lib/images/myriad.png">
        <p>暂无记录</p>
    </div>
<script src="../../lib/js/jquery.min.js"></script>    
<script src="../../lib/js/public-header.js"></script> 
<script type="text/javascript" src="../../lib/js/minirefresh.min.js"></script>
<script>
$(function () {
    //我的保险
    function myinsuranceJson(page,pagesize) {
        let wpuserToken =  window.sessionStorage.getItem('wpuserToken');
        var json = {
            "faceCode":"insurance/myInsuranceList",
            "token":wpuserToken,    
            "clientInfo":"W,100,IE8",  
            "requestTime": formatDateTime(startTime),
            "body":{
                "pageNow":page,
                "pageSize":pagesize
            }
        }
        return json;
    }
    // 初始化页码
    var page = 0; var html = ''; var pagesize = 10;
    // miniRefresh 对象
    var miniRefresh = new MiniRefresh({
        container: '#minirefresh',
        down: {
            isLock: true,//是否禁用下拉刷新
            callback: function () {}
        },
        up: {
            isAuto: true,
            callback: function () {
                page++;// 上拉加载递增页码
                $.ajax({  
                    type: "POST",
                    url: httpServer+"insurance/myInsuranceList",
                    headers:{
                        'Access-Control-Allow-Origin':'*'
                    }, 
                    async:false,
                    contentType: "application/json; charset=utf-8",
                    data: JSON.stringify(myinsuranceJson(page,pagesize)),
                    dataType: "json",
                    success: function (data) {  
                        if(data.resCode!='0'){
                            twoError(data)
                        }else{
                            var arrLen = data.body.insuranceBillList.length;
                            if (arrLen > 0) {
                                $('#myinsuranceNo').css('display','none')
                                $.each(data.body.insuranceBillList, function (key, value) {
                                        html+=`<div class="insurance_list">
                                            <div class="BX_title product-main" data-myinsur="${value.id}" ><h2><img src="../../lib/images/left-tiao.png">尊享e生旗舰版</h2><span></span></div>
                                            <ul class="product-main bx_guarantee">
                                                <li><span>生效日期</span><em>`+value.effectiveTime+`</em></li>
                                                <li><span>终止日期</span><em>`+value.expiryTime+`</em></li>
                                                <li><span>被保人</span><em>`+value.insurantName+`</em></li>
                                                <li><span>保费</span><em>`+value.price+`元</em></li>
                                                <li><span>保额</span><em>`+value.amount+`元</em></li>
                                            </ul>
                                        </div>`
                                       // $('#myinsurance').html(html)
                                });
                                setTimeout(function () { // 使用 setTimeout 函数是方便演示的，你可以不用 setTimeout 函数
                                        $('#myinsurance').html(html)
                                       // $('#transactMain').append(html);
                                        if (data.body.totalPage == page) {// 是否已取完数据页
                                            miniRefresh.endUpLoading(true);// 结束上拉加载
                                        } else {
                                            miniRefresh.endUpLoading(false);
                                        }
                                    
                                }, 600);
                                $('#myinsurance').on('click','.BX_title',function(){
                                    window.location.href='policyDetails.html';
                                    window.sessionStorage.setItem('wppolicyId',$(this).attr('data-myinsur'))
                                })
                            } else {
                                if(data.body.totleRows!='0'){
                                    $('.upwrap-tips').css('display','inline-block')
                                }else{
                                    $('#myinsurance').html(`<div class="common_myriad" id="myinsuranceNo"><img src="../../lib/images/myriad.png"><p>暂无记录</p></div>`)
                                    $('.upwrap-tips').css('display','none')
                                }
                                    miniRefresh.endUpLoading(true);
                                
                            }
                        }
                    },
                    error: function(error){  
                        console.log(error,1);  
                    }    
                }); 
            }
        }
    });
});
</script> 
</body>
</html>